function onback() {
	app.dialog.confirm("确认退出？", function() {

		plus.runtime.quit();
	});
};
var routesData = [{ //首页
		path: '/',
		url: './app.html',
		//		name: 'home',
		on: {
			pageInit: function(event, page) {
				plus.key.removeEventListener('backbutton', onback);
				//				
				/*
				 *登录并实现首页功能
				 */
				$$("div.login-screen  input[type='checkbox']").on("click", function() {
					if($$(".unCheck").css("display") == "block") {
						$$(".unCheck").css({
							"display": "none"
						});
						$$(".check").css({
							"display": "inline-block"
						});
					} else {
						$$(".check").css({
							"display": "none"
						});
						$$(".unCheck").css({
							"display": "inline-block"
						});
					}
				});
				$$(".switchAddress").css({
					"right": "-" + screen.width + 'px'
				});
				$$(".login-screen-title").on("click", "i", function() {
					$$(".switchAddress").css({
						'right': 0
					});
				});
				$$(".switchAddress").on("click", 'p', function() {
					$$(this).addClass("active").siblings("p").removeClass("active");
					plus.storage.setItem('locationHref', $$(this).data('url'));
				});
				$$(".switchAddress").on("click", 'button', function() {
					$$(".switchAddress").css({
						right: "-" + screen.width + 'px'
					});
				});
				if(plus.storage.getItem('locationHref')) {
					$$(".switchAddress p").each((index, ele) => {
						if($$(ele).data("url") == plus.storage.getItem('locationHref')) {
							$$(ele).addClass("active").siblings("p").removeClass("active");
							return false;
						};
					});
				} else {
					plus.storage.setItem("locationHref", $$(".switchAddress p.active").data("url"));
				};

				//点击登录
				$$(".loginPage").on("click", function() {

					var $$this = $$(this);
					$$this.html("正在登录").css({
						"background": "#ccc"
					});
					var username = $$('input#demo-username-1').val();
					var password = $$('input#demo-password-1').val();
					Framework7.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Account/Login",
						crossDomain: true,
						method: "POST",
						data: {
							LoginName: username,
							Password: hex_md5(password),
							CurrPassword:password
						},
						success: (data, status, xhr) => {
							$$("ul.business").hide();
							$$('.ptr-content').hide();
							addLoading();
							$$this.css({
								"background": "#52C3F1"
							});
							//判断是否记住密码
							if($$(".check").css("display") == "block") {
								plus.storage.setItem("username", username);
								plus.storage.setItem("password", password);
								plus.storage.removeItem("inventoryname");
							} else {
								plus.storage.setItem("inventoryname", username);
							};
							var _data = JSON.parse(data);
							if(_data['successed']) {
								ajaxUserAsset(0);
								app.loginScreen.close();
								$$(".login-screen").hide();
							} else {
								$$this.css({
									"background": "#52C3F1"
								}).html("登录");
								alert('账号或者密码错误！');
							};
						},
						error: (xhr, status) => {
							$$this.css({
								"background": "#52C3F1"
							}).html("登录");
							console.log("登陆失败");
						}
					});
				});
				if(plus.storage.getItem("inventoryname") || plus.storage.getItem("username")) {

					if($$(".login-screen").css("display") == "block" && !plus.storage.getItem("inventoryname")) {
						$$('input#demo-username-1').val(plus.storage.getItem("username"));
						$$('input#demo-password-1').val(plus.storage.getItem("password"));
						$$(".check").css({
							"display": "inline-block"
						});
						$$(".unCheck").hide();
						$$(".loginPage").click();
					} else if($$(".login-screen").css("display") == "none") {
						app.infiniteScroll.create("#J_stockCheckPlanListInner .infinite-scroll-content");
						ajaxUserAsset(0);
					};

				};

				/*
				 *下拉刷新
				 * @pullToRefresh 初始化下拉刷新的pageIndex
				 * @allowInfinite 判断无限滚动是否重叠
				 * @assetSerialNumber 资产序列号，超出就关闭
				 */
				var pullToRefresh = 0;
				//Loading flag
				var allowInfinite = true;
				var assetSerialNumber = 0;
				var $ptrContent = $$('.ptr-content');
				$ptrContent.on('ptr:refresh', function(e) {
					assetSerialNumber = 0;
					pullToRefresh = 0
					ajaxUserAsset(pullToRefresh);
					app.infiniteScroll.create("#J_stockCheckPlanListInner .infinite-scroll-content");
					$$('#J_stockCheckPlanListInner .infinite-scroll-preloader').show();
				});

				function ajaxUserAsset(pullToRefresh, searchId) {
					Framework7.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/PersonalAssets",
						crossDomain: true,
						dataType: 'json',
						data: {
							pageIndex: +pullToRefresh,
							"-资产编码": searchId
						},
						success: (data, status, xhr) => {
							if(pullToRefresh == 0) {
								$$("#J_stockCheckPlanListInner #HomePageAsset ul").empty();
							};
							var _data = window.dataHandle(data);
							if(data['successed']) {
								var result = {
									dataList: _data
								};
								var templateHomePageAsset = Template7.compile($$("script#templateHomePageAsset").html());
								$$("#J_stockCheckPlanListInner #HomePageAsset >ul").append(templateHomePageAsset(result));
								allowInfinite = true;
								app.ptr.done();

							};
							$$(".loadings").remove();
							$$("ul.business").show();
							$ptrContent.show();
							assetSerialNumber += _data.length;
							if(assetSerialNumber >= data.total) {
								app.infiniteScroll.destroy('#J_stockCheckPlanListInner .infinite-scroll-content');
								$$('#J_stockCheckPlanListInner .infinite-scroll-preloader').hide();
							}
						},
						error: (xhr, status) => {
							console.log(status);
							$$(".loadings").remove();
							$ptrContent.show();
						}
					});
				}
				/*
				 *
				 * 无限滚动
				 * 
				 */
				$$('#J_stockCheckPlanListInner .infinite-scroll-content').on('infinite', function() {
					if(!allowInfinite) return;
					allowInfinite = false;
					pullToRefresh++;
					ajaxUserAsset(pullToRefresh);
				});
				//首页搜索
				$$('input[type="search"]').on('input', function(e) {
					ajaxUserAsset(0, e.target.value);
				});
				//plus.key.addEventListener("backbutton", onback, false);

			},
			pageBeforeIn: function() {

				plus.key.addEventListener("backbutton", onback, false);

			},
		},
	},
	{ //我的资产
		name: 'userAsset',
		path: '/user-asset/',
		url: './user-asset.html',
		on: {
			pageInit: function(e, page) {
				plus.key.removeEventListener('backbutton', onback);
				var num = 0;
				var templateUserAssetMseeage = Template7.compile($$('script#templateUserAssetMseeage').html());
				$$("#userAssetContent").hide();
				addLoading();
				app.request({
					url: "http://" + plus.storage.getItem('locationHref') + "/Common/GetAPPUserModel",
					crossDomain: true,
					data: {

					},
					dataType: 'JSON',
					success: (data, status, xhr) => {
						var _data = JSON.parse(data);
						if(_data['successed']) {
							num++;
							$$("#asset-num").css({
								"padding": "1rem 0"
							}).append(templateUserAssetMseeage(_data));
							if(num == 2) {
								$$("#userAssetContent").show()
								$$(".loadings").remove();
							};
						};
					},
					error: (xhr, status) => {
						console.log(xhr);
					}
				});
				/*
				 *下拉刷新
				 * @pullToRefresh 初始化下拉刷新的pageIndex
				 * @allowInfinite 判断无限滚动是否重叠
				 * @assetSerialNumber 资产序列号，超出就关闭
				 */
				ajaxUserAsset1(0);
				var pullToRefresh = 0;
				//Loading flag
				var allowInfinite = true;
				var assetSerialNumber = 0;
				var $ptrContent = $$('.ptr-content');
				var templateUserAsset = Template7.compile($$("script#templateUserAsset").html());
				$ptrContent.on('ptr:refresh', function() {
					assetSerialNumber = 0;
					pullToRefresh = 0;
					app.infiniteScroll.create("#userAssetList .infinite-scroll-content");
					$$('#userAssetList .infinite-scroll-preloader').show();
					ajaxUserAsset1(pullToRefresh);
				});

				/*
				 *
				 * 无限滚动
				 * 
				 */
				$$('#userAssetList .infinite-scroll-content').on('infinite', function() {
					if(!allowInfinite) return;
					allowInfinite = false;
					pullToRefresh++;
					ajaxUserAsset1(pullToRefresh);
				});

				//搜索
				$$('input[type="search"]').on('input', function(e) {
					ajaxUserAsset1(0, e.target.value);
				});

				function ajaxUserAsset1(pullToRefresh, searchId) {
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/PersonalAssets",
						crossDomain: true,
						dataType: 'json',
						data: {
							pageIndex: pullToRefresh,
							"-资产编码": searchId
						},
						success: (data, status, xhr) => {
							if(pullToRefresh == 0) {
								$$("div#userAssetBox > ul").empty();
							};
							var _data = window.dataHandle(data);
							var result = {
								dataList: _data
							};
							allowInfinite = true;
							$$("#userAssetBox >ul").append(templateUserAsset(result));
							app.ptr.done("div#userAssetList .ptr-content");
							$$(".loadings").remove();
							$ptrContent.show();
							assetSerialNumber += _data.length;
							if(assetSerialNumber >= data.total) {
								app.infiniteScroll.destroy('#userAssetList .infinite-scroll-content');
								$$('#userAssetList .infinite-scroll-preloader').hide();
							};
							num++;
							if(num >= 2) {
								$$("#userAssetContent").show();
								$$(".loadings").remove();
							};
						},
						error: (xhr, status) => {
							console.log(status + "---240");
							$$(".loadings").remove();
							$ptrContent.show();
						}
					});
				}
			},
			pageAfterIn: function() {
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			}
		}
	},
	{ //资产查询
		name: "assetChaxun",
		path: "/asset-search/",
		url: "./asset-search.html",
		on: {
			pageInit: function() {
				plus.key.removeEventListener('backbutton', onback);
				var _this = this;
				var templateDialog = Template7.compile($$('script#templateDialog').html());
				var templateUserMan = Template7.compile($$('script#templateUserMan').html());
				var calendarDefault = app.calendar.create({
					inputEl: '#demo-calendar-default1',
				});
				var calendarDefault = app.calendar.create({
					inputEl: '#demo-calendar-default2',
				});
				/***使用人***/
				$$(".UsingMenIdFalse").on("click", function() {
					if($$("input[name='UsingDepartmentId']").val() != "") {
						app.popup.open(".UsingMenId", true);
					} else {
						//						app.popup.open(".UsingMenId", true);
						app.dialog.alert('请选择使用部门');
						setTimeout(() => app.popup.open(".UsingDepartmentId", true), 1000);
					}
				});
				/***精确查找***/
				$$("#searchForm").on("click", "button.accurateBtn", function(e) {
					if($$("section#assetSearch .accurateSearch").css("display") == "none") {
						$$("section#assetSearch .accurateSearch").css({
							"display": "block"
						});
					} else {
						$$("section#assetSearch .accurateSearch").css({
							"display": "none"
						});
					};

				});
				/***资产分类***/
				$$('.AssetTypeId').on('popup:open', function(e, popup) {
					$$(e.target).append("<div class='loadings' style='position:fixed;left:0px;right:0px;top:50px;bottom:0px;z-index:9999;'><img src='../i/loading.gif' style='top:40%;left:50%;position:absolute;transform:translate(-50% -50%);'></div>").find(".dialogContent").empty();
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/TreeSelector",
						crossDomain: true,
						dataType: 'json',
						data: {
							_type: "AmsAssetTypes"
						},
						success: function(data) {
							$$(e.target).find(".dialogContent").html(templateDialog(data));
							$$(".loadings").remove();
							$$(e.target).find("i").on("click", function(e) {
								e.stopPropagation();
								if($$(e.target).siblings("ul").css("display") == "none") {
									$$(e.target).siblings("ul").show();
								} else if($$(e.target).siblings("ul").css("display") == "block") {
									$$(e.target).siblings("ul").hide();
								}
							});
							//返回选中值
							$$(e.target).find("li").on("click", function(e) {
								e.stopPropagation();
								var $$this = $$(this);
								var app = _this.app;
								app.dialog.confirm('是否选中', function() {
									$$("input.AssetTypeIdFalse").val($$this.children("span").html());
									$$("input[name='AssetTypeId']").val($$this.data("id"));
									app.popup.close();
								});
							});
						}
					});
				});
				/***使用部门***/
				$$('.UsingDepartmentId').on('popup:open', function(e, popup) {
					$$(e.target).append("<div class='loadings' style='position:fixed;left:0px;right:0px;top:50px;bottom:0px;z-index:9999;'><img src='../i/loading.gif' style='top:40%;left:50%;position:absolute;transform:translate(-50% -50%);'></div>").find(".dialogContent").empty();
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/TreeSelector",
						crossDomain: true,
						dataType: 'json',
						data: {
							_type: "AmsDepartments"
						},
						success: function(data) {

							$$(e.target).find(".dialogContent").html(templateDialog(data));
							$$(".loadings").remove();
							$$(e.target).find("i").on("click", function(e) {
								e.stopPropagation();
								if($$(e.target).siblings("ul").css("display") == "none") {
									$$(e.target).siblings("ul").show();
								} else if($$(e.target).siblings("ul").css("display") == "block") {
									$$(e.target).siblings("ul").hide();
								}
							});
							//返回选中值
							$$(e.target).find("li").on("click", function(e) {
								e.stopPropagation();
								var $$this = $$(this);
								var app = _this.app;
								app.dialog.confirm('是否选中', function() {
									$$("input.UsingDepartmentIdFalse").val($$this.children("span").html()).data("id", $$this.data("id"));
									$$("input[name='UsingDepartmentId']").val($$this.data("id"));
									app.popup.close();
								});
							});
						}
					});
				});
				/***使用人***/
				$$('.UsingMenId').on('popup:open', function(e, popup) {
					$$(e.target).append("<div class='loadings' style='position:fixed;left:0px;right:0px;top:50px;bottom:0px;z-index:9999;'><img src='../i/loading.gif' style='top:40%;left:50%;position:absolute;transform:translate(-50% -50%);'></div>").find("#UsingMenId > ul").empty();
					app.infiniteScroll.create(".UsingMenId .infinite-scroll-content");
					$$('.UsingMenId .infinite-scroll-preloader').show();
					var pullToRefresh = 0;
					var allowInfinite = true;
					var assetSerialNumber = 0;
					ajaxUsingMenId(pullToRefresh)
					/*
					 *
					 * 无限滚动
					 * 
					 */
					$$('.UsingMenId .infinite-scroll-content').on('infinite', function() {
						if(!allowInfinite) return;
						allowInfinite = false;
						pullToRefresh++;
						ajaxUsingMenId(pullToRefresh);
					});

					function ajaxUsingMenId(pullToRefresh) {
						app.request({
							url: "http://" + plus.storage.getItem('locationHref') + "/Common/GridSelector",
							crossDomain: true,
							dataType: 'json',
							data: {
								_type: "AmsProfiles",
								DepartmentId: $$("input[name='UsingDepartmentId']").val(),
								pageIndex: +pullToRefresh
							},
							success: function(data) {
								var _data = window.dataHandle(data)
								var result = {
									dataList: _data
								};
								$$(e.target).find("#UsingMenId > ul").append(templateUserMan(result));
								$$(".loadings").remove();
								allowInfinite = true;
								assetSerialNumber += _data.length;
								if(assetSerialNumber >= data.total || assetSerialNumber < 20) {
									app.infiniteScroll.destroy('.UsingMenId .infinite-scroll-content');
									$$('.UsingMenId .infinite-scroll-preloader').hide();
								}
								//返回选中值
								$$(e.target).find("li").on("click", function(e) {
									e.stopPropagation();
									var $$this = $$(this);
									var app = _this.app;
									app.dialog.confirm('是否选中', function() {
										pullToRefresh = null;
										allowInfinite = null;
										assetSerialNumber = null;
										$$("input.UsingMenIdFalse").val($$this.children("span").html());
										$$("input[name='UsingMenId']").val($$this.data("id"));
										app.popup.close();
									});
								});

							}
						});
					}
					$$('.UsingMenId').on('popup:closed', function(e, popup) {
						pullToRefresh = null;
						allowInfinite = null;
						assetSerialNumber = null;
					});
				});

				/***管理部门***/
				$$('.DutyDepartmentId').on('popup:open', function(e, popup) {
					$$(e.target).append("<div class='loadings' style='position:fixed;left:0px;right:0px;top:50px;bottom:0px;z-index:9999;'><img src='../i/loading.gif' style='top:40%;left:50%;position:absolute;transform:translate(-50% -50%);'></div>").find(".dialogContent").empty();
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/TreeSelector",
						crossDomain: true,
						dataType: 'json',
						data: {
							_type: "AmsDepartments"
						},
						success: function(data) {

							$$(e.target).find(".dialogContent").html(templateDialog(data));
							$$(".loadings").remove();
							$$(e.target).find("i").on("click", function(e) {
								e.stopPropagation();
								if($$(e.target).siblings("ul").css("display") == "none") {
									$$(e.target).siblings("ul").show();
								} else if($$(e.target).siblings("ul").css("display") == "block") {
									$$(e.target).siblings("ul").hide();
								}
							});
							//返回选中值
							$$(e.target).find("li").on("click", function(e) {
								e.stopPropagation();
								var $$this = $$(this);
								var app = _this.app;
								app.dialog.confirm('是否选中', function() {
									$$("input.DutyDepartmentIdFalse").val($$this.children("span").html()).data("id", $$this.data("id"));
									$$("input[name='DutyDepartmentId']").val($$this.data("id"));
									app.popup.close();
								});
							});
						}
					});
				});
				/***资产状态***/
				$$('.AssetStatusId').on('popup:open', function(e, popup) {
					$$(e.target).append("<div class='loadings' style='position:fixed;left:0px;right:0px;top:50px;bottom:0px;z-index:9999;'><img src='../i/loading.gif' style='top:40%;left:50%;position:absolute;transform:translate(-50% -50%);'></div>").find(".dialogContent").empty();
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Common/TreeSelector",
						crossDomain: true,
						dataType: 'json',
						data: {
							_type: "AmsDictionarys",
							_Root: "00000000-0000-0000-0000-000000000009"
						},
						success: function(data) {

							$$(e.target).find(".dialogContent").html(templateDialog(data));
							$$(".loadings").remove();
							$$(e.target).find("i").on("click", function(e) {
								e.stopPropagation();
								if($$(e.target).siblings("ul").css("display") == "none") {
									$$(e.target).siblings("ul").show();
								} else if($$(e.target).siblings("ul").css("display") == "block") {
									$$(e.target).siblings("ul").hide();
								}
							});
							//返回选中值
							$$(e.target).find("li").on("click", function(e) {
								e.stopPropagation();
								var $$this = $$(this);
								var app = _this.app;
								app.dialog.confirm('是否选中', function() {
									$$("input.AssetStatusIdFalse").val($$this.children("span").html()).data("id", $$this.data("id"));
									$$("input[name='AssetStatusId']").val($$this.data("id"));
									app.popup.close();
								});
							});
						}
					});
				});
				/***表单提交，获取数据***/
				$$('button.btnSearch').on('click', function() {
					var formData = app.form.convertToData('#searchForm');
					app.view[0].router.navigate("/asset-searchContent/?-Code=" + formData['-Code'] + "&AssetTypeId=" + formData['AssetTypeId'] + "&-Model=" + formData["-Model"] + "&UsingDepartmentId=" + formData["UsingDepartmentId"] + "&UsingMenId=" + formData["UsingMenId"] + "&-NameBrand=" + formData["-NameBrand"] + "&costCenter=" + formData["costCenter"] + "&DutyDepartmentId=" + formData["DutyDepartmentId"] + "&-ProviderName=" + formData["-ProviderName"] + "&AssetStatusId=" + formData["AssetStatusId"] + "&》%3DCreatedOnDate=" + formData["》=CreatedOnDate"] + "&《%3DCreatedOnDate=" + formData["《=CreatedOnDate"] + "&-SerialCode=" + formData["-SerialCode"]);

				});
			},
			pageAfterIn: function() {
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			},
		},
	},
	{ //资产查询内容
		name: "assetChaxunContent",
		//		path: "/asset-searchContent/:-Code/:AssetTypeId/:-Model/:UsingDepartmentId/:UsingMenId/:-NameBrand/:costCenter/:DutyDepartmentId/:-ProviderName/:AssetStatusId/:\《\=CreatedOnDate/:\》\=CreatedOnDate/:-SerialCode",
		path: '/asset-searchContent/',
		url: "./asset-search-content.html",
		on: {
			pageInit: function(e, page) {
				plus.key.removeEventListener('backbutton', onback);
				addLoading();
				$$("#A_content").hide();
				var queryData = app.view[0].router.currentRoute.query;
				ajaxSearchContent(0);
				/*
				 *下拉刷新
				 * @pullToRefresh 初始化下拉刷新的pageIndex
				 * @allowInfinite 判断无限滚动是否重叠
				 * @assetSerialNumber 资产序列号，超出就关闭
				 */
				var pullToRefresh = 0;
				var allowInfinite = true;
				var assetSerialNumber = 0;
				var $ptrContent = $$('.ptr-content');
				var templateSearchContent = Template7.compile($$('script#templateSearchContent').html());
				$ptrContent.on('ptr:refresh', function(e) {
					assetSerialNumber = 0;
					pullToRefresh = 0
					ajaxSearchContent(pullToRefresh);
					app.infiniteScroll.create("#A_content .infinite-scroll-content");
					$$('#A_content .infinite-scroll-preloader').show();
				});
				/*
				 *
				 * 无限滚动
				 * 
				 */
				$$('#A_content .infinite-scroll-content').on('infinite', function() {
					if(!allowInfinite) return;
					allowInfinite = false;
					pullToRefresh++;
					ajaxSearchContent(pullToRefresh);
				});
				//分页调用函数
				function ajaxSearchContent(pullToRefresh) {
					queryData['pageIndex'] = pullToRefresh;
					app.request({
						url: "http://" + plus.storage.getItem('locationHref') + "/Report/Asset_Detail?_dt=1513921279845",
						crossDomain: true,
						dataType: 'json',
						data: queryData,
						success: (data) => {
							if(pullToRefresh == 0) {
								$$("div#A_contentBox ul").empty();
							};
							$$(".loadings").remove();
							var _data = window.dataHandle(data)
							var result = {
								dataList: _data
							};
							allowInfinite = true;
							$$("section#A_content .title").html("资产数量：" + data['total'] + "条");
							$$("div#A_contentBox >ul").append(templateSearchContent(result));
							app.ptr.done("div.A_contentBox .ptr-content");
							assetSerialNumber += _data.length;
							$$("#A_content").show();
							//假如到达总数
							if(assetSerialNumber >= data.total) {
								app.infiniteScroll.destroy('#A_content .infinite-scroll-content');
								$$('#A_content .infinite-scroll-preloader').hide();
							}
						},
						error: (xhr, status) => {
							console.log(status + "---447");
						}
					});

				}

				/*$$("#linkback").on("click",function(){
						app.view[0].router.back('',{
							ignoreCache:true
						});
				});*/
			},
			pageAfterIn: function() {
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			}
		}
	},
	{ //个人中心
		name: "userCenter",
		path: '/user-center/',
		url: './user-center.html',
		on: {
			pageInit: function(event, page) {
				plus.key.removeEventListener('backbutton', onback);
				addLoading();
				$$(".screen").hide();
				var _this = this;
				app.request({
					url: "http://" + plus.storage.getItem('locationHref') + "/Common/GetAPPUserModel",
					crossDomain: true,
					data: {

					},
					type: "get",
					dataType: "json",
					success: function(data, status, xhr) {
						$$(".loadings").remove();
						_this.userInformation = data;
						var templateUserInformation = Template7.compile($$('script#templateUserInformation').html());
						$$("section.user").append(templateUserInformation(data));
						$$(".screen").show();
					},
					error: function(xhr, status) {
						console.log(status + "---478");
					}
				});

			},
			pageAfterIn: function() {
				var _this = this;
				$$(".logout").on("click", function() {
					var app = _this.app;
					app.dialog.confirm('你，确定退出登录？', function() {
						plus.storage.setItem('username', '');
						plus.storage.setItem('password', '');
						plus.storage.setItem("inventoryname", "");
						window.location.reload();
					});
				});
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			}

		},
	},
	{ //资产扫描
		name: "scanStocktak",
		path: '/scan-stocktak/',
		url: './scan-stocktak.html',
		on: {
			pageInit: function(event, page) {
				var queryData = app.view[0].router.currentRoute.query;
				var scan = new plus.barcode.Barcode('bcid');
				var stocktakState = "正常"; //盘点结果
				scan.start();
				var appHistory = app.view[0].router.history;
				plus.key.removeEventListener('backbutton', onback);
				var closepage = function() {
					if(queryData['_type'] == "assetCode") {
						app.view[0].router.back();
						//监听安卓返回按钮
						plus.key.addEventListener("backbutton", function() {
							scan.close();
							app.view[0].router.back()
						}, false);
					} else {
						//监听安卓返回按钮
						plus.key.addEventListener("backbutton", function() {
							scan.close();
							app.view[0].router.back(appHistory[appHistory.length - 2], {
								force: true
							});
						}, false);
						app.view[0].router.back(appHistory[appHistory.length - 2], {
							force: true
						});
					}
				};

				//关闭
				$$("#closePage").on('click', function() {
					scan.close();
					closepage();

				});
				//打开闪光灯
				$$("#setFlash").on("click", function() {
					if($$(this).hasClass('active')) {
						$$(this).removeClass('active');
						scan.setFlash(false);
					} else {
						$$(this).addClass('active');
						scan.setFlash(true);
					}
				});
				//暂停按钮
				$$('#pauseScan').click(function() {
					if($$(this).text() === '暂停') {
						$$(this).text('开始');
						$$('#setFlash').removeClass('active');
						scan.cancel();

					} else {
						$$(this).text('暂停');
						scan.start();
					}
				});
				if(queryData['_type'] == "assetCode") { //假如为资产查询扫描
					scan.onmarked = function(type, result) {
						var data = result;
						try {
							data = JSON.parse(result)
						} catch(e) {};
						scan.close();
						if(data['资产编码']) {
							app.view[0].router.navigate("/asset-searchContent/?-Code=" + data['资产编码'], {
								reloadCurrent: true
							});
						} else {
							app.dialog.alert("扫描信息有误，无资产编码", "资产扫描", function() {
								app.view[0].router.refreshPage();
							});
						}
					};
				} else if(queryData['_type'] == "homeCode") { //假如为房间地址扫描
					scan.onmarked = function(type, result) {
						var data = result;
						try {
							data = JSON.parse(result)
						} catch(e) {

						};
						scan.close();
						getHomeCode(data);
					};
				} else if(queryData['_type'] == "inventoryCode") { //假如为资产盘点 
					var DocumentId = queryData.id;
					/***********盘点结果异常问题 start**************/
					$$(".stateBtn").on("click", "button", function() {
						$$(this).addClass("active").siblings().removeClass("active");
						stocktakState = $$(this).html();
					});
					$$(".stateBtnAnomaly").on("click", "button", function() {
						if($$(this).hasClass('active')) {
							$$(this).removeClass("active");
						} else {
							$$(this).addClass("active");
						}
					});
					$$(".stateBtn").on("click", ".stateAnomaly", function() {
						$$(".stateBtnAnomaly").show();
					});
					$$(".stateBtn").on("click", ".normal,.inventorySurplus", function() {
						$$(".stateBtnAnomaly").hide();
					});
					/**************盘点结果异常问题 end***************/
					scan.onmarked = function(type, result) {
						var data = result;
						try {
							data = JSON.parse(result);
						} catch(e) {

						};
						if(!data['唯一标识']) {
							scan.close();
							app.dialog.alert("无资产编码", function() {
								app.view[0].router.refreshPage();
							});
						} else {
							getInventoryCode(data)
						};

					};

				};

				//资产盘点
				function getInventoryCode(data) {
					//模板
					var templateStocktakMes = Template7.compile($$('script#templateStocktakMes').html());
					var itemCode, itemId, itemAdress;
					itemCode = data;
					itemId = itemCode['唯一标识'];
					itemAssId = itemCode["资产编码"];
					var homeCodePlus = plus.storage.getItem("homeCode");
					var TakeStockTaskItem = Base.getInventoryAssetListContentId(DocumentId, itemId);
					/*
					 *主要数据 
					 * @wvB.addressSave 位置地址
					 * @TakeStockTaskItem 盘点单数据某个资产
					 * @itemAssId 二维码的资产编码
					 * @itemId 二维码的唯一标识
					 * @stocktakState 盘点结果
					 * @stocktakRemark  textarea.remarks备注
					 * */
					/***位置信息已近扫描***/
					if(homeCodePlus) {
						/***盘点单找得到***/
						if(TakeStockTaskItem) {
							/***资产位置信息和房间位置信息一致***/
							if(homeCodePlus == TakeStockTaskItem['StoreCode']) {
								scan.close();
								$$(".dia_log").show();
								$$(".inventorySurplus").hide();
								TakeStockTaskItem["StoreCodeName"] = Base.getRoomInformation(TakeStockTaskItem['StoreCode']);
								$$("#templateStocktakMesDiv").append(templateStocktakMes(TakeStockTaskItem));
								$$(".dia_log").on("click", ".enter", function(e) {

									e.stopPropagation();
									var stocktakRemark = $$(".remarks").val();
									$$(".stateBtnAnomaly button").each(function(index, ele) {
										if($$(ele).hasClass("active")) {
											stocktakRemark += "　" + $$(ele).html();
										}
									});
									$$("#templateStocktakMesDiv p").each(function(index, ele) {
										if(!$$(ele).children("input[type='checkbox']").is(":checked")) {
											stocktakRemark += "　" + $$(ele).children('span').html() + "异常";
										}
									});
									var stocktakData = {
										'AssetId': itemId,
										'资产编码': itemAssId,
										'盘点结果': stocktakState,
										'盘点异常': '',
										'盘点状态': "已盘",
										'盘点备注信息': stocktakRemark,
										"StoreCode": homeCodePlus,
									}
									Base.updateInventoryAssetListContentId(DocumentId, itemId, stocktakData);
									$$(".dia_log").hide();
									$$(".am-icon-check").show();
									app.view[0].router.refreshPage();
								});
								//取消
								$$(".dia_log").on("click", ".cancel", function() {
									scan.start();
									$$(".dia_log").hide();
									app.view[0].router.refreshPage();
								});
							} else { /***位置信息不存在***/
								if(!TakeStockTaskItem['StoreCode']) {
									scan.close();
									app.dialog.confirm("该资产没有位置信息，是否用房间位置覆盖", () => {
										//确认
										$$(".dia_log").show();
										$$(".inventorySurplus").hide();
										$$("#templateStocktakMesDiv").append(templateStocktakMes(TakeStockTaskItem));
										$$(".dia_log").on("click", ".enter", function(e) {
											e.stopPropagation();
											var stocktakRemark = $$(".remarks").val();
											$$(".stateBtnAnomaly button").each(function(index, ele) {
												if($$(ele).hasClass("active")) {
													stocktakRemark += "　" + $$(ele).html();
												}
											});
											$$("#templateStocktakMesDiv p").each(function(index, ele) {
												if(!$$(ele).children("input[type='checkbox']").is(":checked")) {
													stocktakRemark += "　" + $$(ele).children('span').html() + "异常";
												}
											});
											var stocktakData = {
												'AssetId': itemId,
												'资产编码': itemAssId,
												'盘点结果': stocktakState,
												'盘点异常': '',
												'盘点状态': "已盘",
												'盘点备注信息': stocktakRemark,
												"StoreCode": homeCodePlus,
											}
											Base.updateInventoryAssetListContentId(DocumentId, itemId, stocktakData);
											$$(".dia_log").hide();
											$$(".am-icon-check").show();
											app.view[0].router.refreshPage();
										});
										//取消
										$$(".dia_log").on("click", ".cancel", function() {
											scan.start();
											$$(".dia_log").hide();
											app.view[0].router.refreshPage();
										});
									}, () => {
										/***不覆盖***/
										app.view[0].router.refreshPage();
									});

									/***资产位置信息和房间位置信息不一致***/
								} else {
									scan.close();
									$$(".normal,.inventorySurplus").hide().removeClass("active");
									TakeStockTaskItem["StoreCodeName"] = Base.getRoomInformation(TakeStockTaskItem['StoreCode']);
									$$("#templateStocktakMesDiv").append(templateStocktakMes(TakeStockTaskItem));
									$$(".stateBtnAnomaly").show();
									$$(".stateBtnAnomaly button").eq(0).addClass("active");
									$$(".remarks").val("位置异常");
									stocktakState = "异常";
									$$(".dia_log").show();
									//确定提交
									$$(".dia_log").on("click", ".enter", function() {
										var stocktakRemark = $$(".remarks").val();

										$$("#templateStocktakMesDiv p").each(function(index, ele) {
											if(!$$(ele).children("input[type='checkbox']").is(":checked")) {
												stocktakRemark += "　" + $$(ele).children('span').html() + "异常";
											}
										});
										var stocktakData = {
											'AssetId': itemId,
											'资产编码': itemAssId,
											'盘点结果': stocktakState,
											'盘点异常': '',
											'盘点状态': "已盘",
											'盘点备注信息': stocktakRemark,
											"StoreCode": homeCodePlus,
										}
										Base.updateInventoryAssetListContentId(DocumentId, itemId, stocktakData);
										$$(".dia_log").hide();
										$$(".am-icon-check").show();
										app.view[0].router.refreshPage();
									});
									//取消
									$$(".dia_log").on("click", ".cancel", function() {
										scan.start();
										$$(".dia_log").hide();
										app.view[0].router.refreshPage();
									});
								}
							}

							/***该盘点单找不到，从盘点总资产找***/
						} else {
							scan.close();
							$$(".normal,.stateAnomaly").hide().removeClass("active");
							$$(".inventorySurplus").addClass("active");
							stocktakState = "盘盈";
							var _dataList;
							var tx = db.transaction('AssetInfo', 'readwrite');
							var store = tx.objectStore('AssetInfo');
							var req = store.get(itemId);
							req.onsuccess = function() {
								_dataList = this.result;
								_dataList.Code = _dataList['资产编号'];
								_dataList.StoreCode = _dataList['StorePlaceCode'];
								_dataList["StoreCodeName"] = Base.getRoomInformation(_dataList['StoreCode']);
								$$("#templateStocktakMesDiv").append(templateStocktakMes(_dataList));
								$$(".dia_log").show();
							};

							setTimeout(function() {
								if(!_dataList) {
									alert("盘点总资产未能找到");
									app.view[0].router.refreshPage();
								};
							}, 1000);
							//确定提交
							$$(".dia_log").on("click", ".enter", function(e) {
								e.stopPropagation();
								var stocktakRemark = $$(".remarks").val();
								$$("#templateStocktakMesDiv p").each(function(index, ele) {
									if(!$$(ele).children("input[type='checkbox']").is(":checked")) {
										stocktakRemark += "　" + $$(ele).children('span').html() + "异常";
									}
								});
								$$(".stateBtnAnomaly button").each(function(index, ele) {
									if($$(ele).hasClass("active")) {
										stocktakRemark += "　" + $$(ele).html();
									}
								});
								var stocktakData = {
									'AssetId': itemId,
									'资产编码': itemAssId,
									'盘点结果': "盘盈",
									'盘点异常': '',
									'盘点状态': "已盘",
									'盘点备注信息': stocktakRemark,
									"StoreCode": homeCodePlus,
								};
								for(var i in stocktakData) {
									_dataList[i] = stocktakData[i];
								};
								//								$.extend(_dataList, stocktakData);
								Base.createInventoryAssetListContentId(DocumentId, _dataList, "盘盈");
								$$(".dia_log").hide();
								$$(".am-icon-check").show();
								app.view[0].router.refreshPage();

							});
							//取消
							$$(".dia_log").on("click", ".cancel", function() {
								scan.start();
								$$(".dia_log").hide();
								app.view[0].router.refreshPage();
							});
						}
						/***未扫描房间地址***/
					} else {
						scan.close();
						app.dialog.alert("未扫描房间地址", function() {
							app.view[0].router.refreshPage();
						});
					}

				};

				//房间地址扫描
				function getHomeCode(data) {
					var _dataHome = data["位置编码"];
					if(_dataHome) {
						var _dataHomeHas = Base.getRoomInformation(_dataHome);
						
						if(_dataHomeHas) {
							app.dialog.alert("位置：" + _dataHomeHas, "位置扫描", function() {
								plus.storage.setItem("homeCode", _dataHome);
								app.view[0].router.back();
							});
						} else {
							app.dialog.alert("位置编码不正确", function() {
								app.view[0].router.refreshPage();
							});
						};
					} else {
						app.dialog.alert("无位置编码", function() {
							app.view[0].router.refreshPage();
						});
					};
				};
				closepage();
			},
			pageAfterIn: function() {

			},
		},
	},
	{
		//资产详情
		name: "assetDetail",
		path: '/asset-detail/',
		url: './asset-detail.html',
		on: {
			pageInit: function(event, page) {
				plus.key.removeEventListener('backbutton', onback);
				var queryData = app.view[0].router.currentRoute.query;
				var templateAssetDetail = Template7.compile($$('script#templateAssetDetail').html());
				var templateAssetDetailOperation = Template7.compile($$('script#templateAssetDetailOperation').html());
				var templateAssetDetailAttachment = Template7.compile($$('script#templateAssetDetailAttachment').html());
				$$(".assetDetail").hide();
				addLoading();
				//资产详情
				app.request({
					url: "http://" + plus.storage.getItem('locationHref') + "/AssetCards/GetAssetCardModel",
					crossDomain: true,
					type: "post",
					data: queryData,
					dataType: "json",
					success: (data) => {
						$$("#assetDetail>ul").append(templateAssetDetail(data));
						$$(".assetDetail").show();
						$$(".loadings").remove();
					},
					error: function(xhr, status) {
						console.log(status + "---资产详情");
					}
				});
			},
			pageAfterIn: function() {
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			},
		}
	},
	{
		//盘点详情
		name: "InventoryOffOnline",
		path: '/Inventory-OffOnline/',
		url: './Inventory-OffOnline.html',
		routes: [{
				path: 'data-update/',
				url: './data-update.html',
				on: {
					pageInit: function(e, page) {
						/*var store = db.transaction("AssetInfo",'readwrite').objectStore("AssetInfo");
						var request = store.get("ec2589ce-cf99-40fb-b036-fb1cf75b15ae");
						request.onsuccess = function(e){
                var result = e.target.result;
                console.log('查找数据成功')
                console.log(JSON.stringify(result));
            };

			request.onerror = function(){
                console.error('getDataByKey error');
            };*/

						plus.key.removeEventListener('backbutton', onback);
						var templateFetchInfoList = Template7.compile($$('script#templateFetchInfoList').html());
						var _data = Base.getDataUpdate();
						var __data = {
							dataList: _data
						};
						$$("#dataUpdata").append(templateFetchInfoList(__data));

						/***盘点任务列表Start***/
						var btn2 = true;
						$$("#InventoryList").on('click', 'button', function() {
							if(!btn2) return false;
							btn2 = false;
							$$(this).text('正在更新').parents("#InventoryList").addClass("active");
							Base.fetchInventoryAssetList();
						});
						$$("#InventoryList").on("InventoryAssetListEnd", function(e, time, val) {
							$$("#InventoryList").removeClass("active").find(".data-update-time").html(time);
							$$('#InventoryList button').text('更新');
							btn2 = true;
							app.dialog.alert(val);
							_data["InventoryList"]["update_time"] = time;
							Base.SetDataUpdate(_data);
						});
						/***盘点任务列表End***/

						/***盘点任务资产Start***/
						var btn1 = true;
						$$('#InventoryAsset').on('click', 'button', function() {
							if(!btn1) return false;
							btn1 = false;
							$$(this).text('正在更新').parents("#InventoryAsset").addClass("active");
							Base.fetchInventoryAsset();
						});
						$$('#InventoryAsset').on("InventoryAssetEnd", function(e, time) {
							$$("#InventoryAsset").removeClass("active").find(".data-update-time").html(time);
							$$('#InventoryAsset button').text('更新');
							btn1 = true;
							app.dialog.alert("更新成功");
							_data["InventoryAsset"]["update_time"] = time;
							Base.SetDataUpdate(_data);
						});
						/***盘点任务资产End***/

					},
					pageAfterIn: function() {
						//监听安卓返回按钮
						plus.key.addEventListener("backbutton", function() {
							app.view[0].router.back()
						}, true);
					}
				}
			},
			{
				path: 'List/',
				url: './Inventory-List.html',
				on: {
					pageInit: function(e, page) {
						plus.key.removeEventListener('backbutton', onback);
						$$("#InventoryAssetList").hide();
						var InventoryAssetListData = Base.getInventoryAssetList();
						var templateInventoryAssetList = Template7.compile($$('script#templateInventoryAssetList').html());
						/*for(var i in InventoryAssetListData){
							InventoryAssetListData[i]['制定日期'] = InventoryAssetListData[i]['制定日期'].slice(0,-8)
						}*/

						/*
						 *
						 * 无限滚动
						 * 
						 */
						var pullToRefresh = 0;
						var allowInfinite = true;
						var assetSerialNumber = 0;
						ajaxInventoryAssetList(pullToRefresh);

						function ajaxInventoryAssetList(pullToRefresh) {
							var _data = InventoryAssetListData.slice((+pullToRefresh) * 20, (+pullToRefresh + 1) * 20);
							var result = {
								dataList: _data
							};
							$$("#InventoryAssetList>div>ul").append(templateInventoryAssetList(result));
							allowInfinite = true;
							assetSerialNumber += _data.length;
							if(assetSerialNumber >= InventoryAssetListData.length || assetSerialNumber < 20) {
								app.infiniteScroll.destroy('#InventoryAssetList .infinite-scroll-content');
								$$('#InventoryAssetList .infinite-scroll-preloader').hide();
							};
							setTimeout(function() {
								$$("#InventoryAssetList").show();
							}, 500);
						};
						$$('#InventoryAssetList .infinite-scroll-content').on('infinite', function() {
							if(!allowInfinite) return;
							allowInfinite = false;
							pullToRefresh++;
							ajaxInventoryAssetList(pullToRefresh);
						});

						$$("a.upLoadBtn").on("click", function(e) {
							var id = $$(this).data("id");
							var stocktakeState = $$(this).data("state");
							var stocktakeEnd = $$(this).data("end");
							app.dialog.confirm("是否提交盘点结果?", function() {
								if(stocktakeEnd != "盘点结束" && stocktakeState == "已盘") {
									app.preloader.show();
									$$(document).on('TakeStockTaskItemListPushDone', function(e, data) {
										app.preloader.hide();
										app.dialog.alert(data.message, "上传数据", function() {
											app.view[0].router.refreshPage();
										});
									});
									Base.pushInventoryAssetList(id);
								} else if(stocktakeState == "未盘") {
									app.dialog.alert("该盘点单未离线保存");
								} else {
									app.dialog.alert("该盘点单已经提交，请勿再次提交");
								}
							});

						});

					},
					pageAfterIn: function() {

						plus.storage.setItem("homeCode", "");
						//监听安卓返回按钮
						plus.key.addEventListener("backbutton", function() {
							app.view[0].router.back()
						}, true);
					}
				}
			},
		],
		on: {
			pageInit: function(event, page) {
				plus.key.removeEventListener('backbutton', onback);
			},
			pageAfterIn: function() {
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, true);
			},
		}
	},
	{
		path: "/Inventory-ListStart/",
		url: './Inventory-ListStart.html/',
		on: {
			pageInit: function(e, page) {
				var appHistory = app.view[0].router.history;
				var queryData = app.view[0].router.currentRoute.query;
				var InventoryAssetListTitle = Base.getInventoryAssetListTitle(queryData.id);
				plus.key.removeEventListener('backbutton', onback);
				$$("a.backBtn").on("click", function() {
					app.view[0].router.back(appHistory[appHistory.length - 2], {
						force: true
					});
				});
				$$("a.qrInventory").on("click", function() {
					app.view[0].router.navigate("/scan-stocktak/?_type=inventoryCode&id=" + queryData['id']);

				});
				$$("a.qrUpload").on("click", function() {
					var _this = this;
					app.dialog.confirm("保存数据时盘点任务为结束，未盘点数据变为盘亏，是否结束盘点，保存盘点结果。", function() {
						if(queryData.stocktakeState == "未盘") {
							app.preloader.show();
							$$(_this).on("setInventoryAssetListDone", function(e, data) {
								app.preloader.hide();
								app.dialog.alert(data.message, "本地保存", function() {
									app.view[0].router.back(appHistory[appHistory.length - 2], {
										force: true
									});
								});

							});
							Base.localInventoryAssetList(queryData.id);
						} else {
							app.dialog.alert("该盘点单已经保存，请勿再次保存", "资产盘点", function() {
								app.view[0].router.back();
							});
						};
					});
				});
				//盘点任务列表标题信息
				var templateInventoryAssetListTitle = Template7.compile($$("script#templateInventoryAssetListTitle").html());
				//盘点任务列表内资产
				var templateInventoryAssetListContent = Template7.compile($$("script#templateInventoryAssetListContent").html());

				$$(".InventoryAssetListTitle").append(templateInventoryAssetListTitle(InventoryAssetListTitle));

				var InventoryNot = Base.getInventoryAssetListContent(queryData.id, {
					'盘点状态': '未盘'
				});
				var InventoryHas = Base.getInventoryAssetListContent(queryData.id, {
					'盘点状态': '已盘'
				});
//				InventoryNot["StoreCodeName"] = Base.getRoomInformation(InventoryNot['StoreCode']);
				
				InventoryNot.map((ele,i)=>{
					return ele["StoreCodeName"] = Base.getRoomInformation(ele['StoreCode'])
				});
				InventoryHas.map((ele,i)=>{
					return ele["StoreCodeName"] = Base.getRoomInformation(ele['StoreCode'])
				});
				
				$$("#InventoryListStart .forInventory").text(InventoryNot.length);
				$$("#InventoryListStart .haveInventory").text(InventoryHas.length);
				//$$("#J_AlreadyStocktak").append(templateInventoryAssetListContent(InventoryHas));

				/*
				 *下拉刷新
				 * @pullToRefresh 初始化下拉刷新的pageIndex
				 * @allowInfinite 判断无限滚动是否重叠
				 * @assetSerialNumber 资产序列号，超出就关闭
				 */
				var pullToRefresh = 0;
				var allowInfinite = true;
				var assetSerialNumber = 0;
				ajaxInventoryNot(0);
				$$('#tab-1 .ptr-content').on('ptr:refresh', function(e) {
					assetSerialNumber = 0;
					pullToRefresh = 0
					app.infiniteScroll.create("#tab-1 .infinite-scroll-content");
					$$('#tab-1 .infinite-scroll-preloader').show();
					ajaxInventoryNot(pullToRefresh);
				});
				/*
				 *
				 * 无限滚动
				 * 
				 */
				$$('#tab-1 .infinite-scroll-content').on('infinite', function() {
					if(!allowInfinite) return;
					allowInfinite = false;
					pullToRefresh++;
					ajaxInventoryNot(pullToRefresh);
				});

				function ajaxInventoryNot(pullToRefresh) {
					if(pullToRefresh == 0) {
						$$("#inventoryNot").empty();
					};
					var _data = InventoryNot.slice(20 * (+pullToRefresh), 20 * (+pullToRefresh + 1));
					for(var i in _data) {
						_data[i]['index'] = 20 * (+pullToRefresh) + (+i) + 1;
					}
					var result = {
						dataList: _data,
					};
					$$("#inventoryNot").append(templateInventoryAssetListContent(result));
					allowInfinite = true;
					app.ptr.done('#tab-1 .ptr-content');
					assetSerialNumber += _data.length;
					if(assetSerialNumber >= InventoryNot.length || assetSerialNumber < 20) {
						app.infiniteScroll.destroy('#tab-1 .infinite-scroll-content');
						$$('#tab-1 .infinite-scroll-preloader').hide();
					};
				};
				/*
				 *下拉刷新
				 * @pullToRefresh 初始化下拉刷新的pageIndex
				 * @allowInfinite 判断无限滚动是否重叠
				 * @assetSerialNumber 资产序列号，超出就关闭
				 */
				var pullToRefresh2 = 0;
				var allowInfinite2 = true;
				var assetSerialNumber2 = 0;
				ajaxInventoryHas(0);
				$$('#tab-2 .ptr-content').on('ptr:refresh', function(e) {
					assetSerialNumber2 = 0;
					pullToRefresh2 = 0;
					app.infiniteScroll.create("#tab-2 .infinite-scroll-content");
					$$('#tab-2 .infinite-scroll-preloader').show();
					ajaxInventoryHas(pullToRefresh2);
				});
				/*
				 *
				 * 无限滚动
				 * 
				 */
				$$('#tab-2 .infinite-scroll-content').on('infinite', function() {
					if(!allowInfinite2) return;
					allowInfinite2 = false;
					pullToRefresh2++;
					ajaxInventoryHas(pullToRefresh2);
				});

				function ajaxInventoryHas(pullToRefresh2) {
					if(pullToRefresh2 == 0) {
						$$("#inventoryHas").empty();
					};
					var _data = InventoryHas.slice(20 * (+pullToRefresh2), 20 * (+pullToRefresh2 + 1));
					for(var i in _data) {
						_data[i]['index'] = 20 * (+pullToRefresh2) + (+i) + 1;
					}
					var result = {
						dataList: _data,
					};
					$$("#inventoryHas").append(templateInventoryAssetListContent(result));
					allowInfinite2 = true;
					app.ptr.done('#tab-2 .ptr-content');
					assetSerialNumber2 += _data.length;
					if(assetSerialNumber2 >= InventoryHas.length || assetSerialNumber2 < 20) {
						$$('#tab-2 .infinite-scroll-preloader').hide();
						app.infiniteScroll.destroy('#tab-2 .infinite-scroll-content');
					};
				}
			},
			pageAfterIn: function() {
				var queryData = app.view[0].router.currentRoute.query;
				//监听安卓返回按钮
				plus.key.addEventListener("backbutton", function() {
					app.view[0].router.back()
				}, false);
			}
		}
	}, {
		path: '(.*)',
		url: './pages/404.html',
	},
]

//});